package org.example.huawei;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

/**
 * @author Yyming
 * @version 10.0
 * Created by Yyming on 2021/1/4
 */
public class Test4 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] elements = new int[20000];
        Arrays.fill(elements, 10001);
        List<Integer> left = new ArrayList<>();
        List<Integer> right = new ArrayList<>();
        while (in.hasNext()) {
            int m = in.nextInt();
            int n = in.nextInt();
            left.add(m);
            right.add(n);
        }
        int size = left.size();
        int[][] inits = new int[size][2];
        for (int i = 0; i < left.size(); i++) {
            inits[i][0] = left.get(i);
            inits[i][1] = right.get(i);
        }

        for (int i = 0; i < size - 1; i++) {
            for (int j = i + 1; j < size; j++) {
                int max0 = Math.max(inits[i][0], inits[j][0]);
                int min1 = Math.min(inits[i][1], inits[j][1]);
                if (max0 > min1) {
                } else {
                    for (int k = 0; k <= min1 - max0; k++) {
                        if (elements[max0 + k + 10000] != 10001) {
                            if (elements[max0 + k + 10000] < max0) {
                                elements[max0 + k + 10000] = max0;
                            }
                        } else {
                            elements[max0 + k + 10000] = max0;
                        }
                    }
                }
            }
        }

        int start = 0;
        int count = 1;
        int none = 0;
        for (int i = 0; i < elements.length - 1; i++) {

            if (elements[i] == 10001) {
                start++;
            } else {
                none++;
                if (elements[i] == elements[i + 1]) {
                    count++;
                } else {
                    System.out.println(elements[start] + " " + (elements[start] + count - 1));
                    start = start + count;
                    count = 1;
                }
            }

        }
        if (none == 0) {
            System.out.println("None");
        }
    }
}
